package com.ly.mpayment.persist.service.callorder;

import com.ly.mpayment.core.util.MapUtil;
import com.ly.mpayment.persist.entity.CallOrder;
import com.ly.mpayment.persist.service.AbstractService;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

@Service
public class ICallOrderServiceImpl extends AbstractService<CallOrder, Serializable> implements ICallOrderService {

    @Override
    public boolean saveOrder(CallOrder order) {
        return this.saveOrUpdate(order) != null;
    }

    @Override
    public boolean deleteOrder(String orderId) {
        try{
            this.delete(orderId);
        }catch (Exception e){
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public CallOrder findById(String orderId) {
        return this.findByUnique("orderId",orderId);
    }

    @Override
    public void updateCall(CallOrder order) {
       try{
           this.updateEntity(order);
       }catch (Exception e){
           //e.printStackTrace();
       }
    }

    @Override
    public List<CallOrder> findByOrder() {
        return this.findPageByNamed("select c from CallOrder c order by c.callTime", MapUtil.getMap(),0,1000).getResult();
    }
}
